<html>
<head><meta charset="utf-8"><title>question about tool module import errors · t-compiler · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/index.html">t-compiler</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html">question about tool module import errors</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231186750"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231186750" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Noah Lev <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231186750">(Mar 21 2021 at 02:29)</a>:</h4>
<p>Why is it that</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">clippy</span>::<span class="n">foo</span><span class="p">;</span><span class="w"></span>
</code></pre></div>
<p>errors with "<code>clippy</code> is a tool module, not a module" but</p>
<div class="codehilite" data-code-language="Rust"><pre><span></span><code><span class="k">use</span><span class="w"> </span><span class="n">rustdoc</span>::<span class="n">foo</span><span class="p">;</span><span class="w"></span>
</code></pre></div>
<p>errors with "use of undeclared crate or module <code>rustdoc</code>"? Aren't they both now tool modules?</p>
<p><strong>Note:</strong> This is on Nightly because the rustdoc tool module is new.</p>



<a name="231187579"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231187579" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Eric Huss <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231187579">(Mar 21 2021 at 02:47)</a>:</h4>
<p>There's a difference between tool attributes and tool lints.  I believe <code>rustdoc</code> is only a lint scope (<del>I believe not even in a formal way, it only compares the lint name by string</del> edit: I guess it is semi-formal <a href="https://github.com/rust-lang/rust/blob/61edfd591cedff66fca639c02f66984f6271e5a6/compiler/rustc_lint/src/levels.rs#L577-L579">here</a>).</p>
<p><code>clippy</code> and <code>rustfmt</code> are the only tools registered for attributes.</p>



<a name="231189157"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231189157" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231189157">(Mar 21 2021 at 03:21)</a>:</h4>
<p>^ this is hard-coded somewhere in rustc_resolve, I remember seeing it when looking at <a href="https://github.com/rust-lang/rust/pull/83216">https://github.com/rust-lang/rust/pull/83216</a></p>



<a name="231189218"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231189218" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231189218">(Mar 21 2021 at 03:22)</a>:</h4>
<p>Rustdoc is no less formal than clippy is, it's just that it's hardcoded in two places and they're not in sync</p>



<a name="231189331"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231189331" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231189331">(Mar 21 2021 at 03:25)</a>:</h4>
<p>I don't understand the difference between a tool scope and a tool module though</p>



<a name="231207210"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231207210" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Vadim Petrochenkov <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231207210">(Mar 21 2021 at 10:22)</a>:</h4>
<p>The plan was to remove the hardcoded tool names once something like <code>#![register_tool]</code> stabilizes.<br>
It should happen at edition boundary due to breakage, and since <code>register_tool</code> doesn't have any blockers for stabilization (?) it may happen together with 2021 edition.</p>



<a name="231214529"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/131828-t-compiler/topic/question%20about%20tool%20module%20import%20errors/near/231214529" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Joshua Nelson <a href="https://rust-lang.github.io/zulip_archive/stream/131828-t-compiler/topic/question.20about.20tool.20module.20import.20errors.html#231214529">(Mar 21 2021 at 12:49)</a>:</h4>
<p>What breakage does register_tool have? And how would it allow removing hardcoded names - by adding register_tool(rustdoc) to the standard library or something?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>